import { createStore } from 'vuex'
import cart from './module/cart'
import user from './module/user'
import category from './module/category'
import createPersistedstate from 'vuex-persistedstate'


export default createStore({
  namespaced:true,
  state: {
    navList: null
  },
  getters: {
  },
  mutations: {
    setHeaderNav(state,payload){
      state.navList = payload
    }
  },
  actions: {
  },
  modules: {
    cart,
    user,
    category
  },
  plugins: [
    createPersistedstate({
      // key为本地存储的键名
      key: 'erabbit-client-pc-store',
      // path为值
      paths: ['user', 'cart']
    })
  ]
})
